/*
 * Copyright (c) 2011 by Konstantin Pavlov.
 */
package gwtlx.html5.client.forms;

import com.google.gwt.dom.client.Element;

/**
 * EmailTextBox is a {@link TextBox} extension which supports valid email values.
 * <p/>
 * Rendered as <code>&lt;input type="email".../&gt;</code>
 *
 * @author Konstantin Pavlov
 * @version $LastChangedRevision: 15 $
 * @since 09.01.11
 */
public class EmailTextBox extends TextBox {

    public EmailTextBox() {
        super();
        init(getElement());
    }

    protected EmailTextBox(Element element) {
        super(element);
        init(element);
    }

    /**
     * Initialize input as email box.
     *
     * @param element an element to initialize.
     */
    private void init(Element element) {
        element.setAttribute("type", "email");
        if ("email".equals(element.getPropertyString("type"))) {
            // email is supported
        } else {
            // email is not supported
        }
    }
}
